//
//  EventRootController.m
//  SmallEasyLife
//
//  Created by qianfeng on 15/10/26.
//  Copyright © 2015年 GXK. All rights reserved.
//

#import "EventRootController.h"

@interface EventRootController ()

@end

@implementation EventRootController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createRightNavButton];
}
- (void)createRightNavButton
{
    UIButton * shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    UIImage * shareImage = [[UIImage imageNamed:@"share_1"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
    [shareButton setImage:shareImage forState:UIControlStateNormal];
    
    shareButton.frame = CGRectMake(0, 0, 60, 60);
    [shareButton addTarget:self action:@selector(shareButtonTaped:) forControlEvents:UIControlEventTouchUpInside];
    
    
    UIBarButtonItem * shareBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:shareButton];
    
    self.navigationItem.rightBarButtonItems = @[shareBarButtonItem];
    
}

- (void)shareButtonTaped:(UIButton *)button
{
    UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"share" message:@"share" preferredStyle:UIAlertControllerStyleAlert];
    
    [alert addAction:[UIAlertAction actionWithTitle:@"关闭" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
        
    }]];
    [self presentViewController:alert animated:YES completion:nil];

}
- (void)setModel:(Event *)model
{
    if (_model != model) {
        _model = model;
        [self modelSetup:model];
    }
}
- (void)modelSetup:(Event *)model
{
    NSLog(@"Override this method for subclass to setup arguments.");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
